package development;

import java.util.Hashtable;

import state.GameForm;
import state.Graphics;
import state.Image;
import state.Key;
import state.util.Color;
import state.util.ImageUtil;

public class FrmTestResizeImage extends GameForm {
  
  private Image testImage;
  
  private static GameForm singleton;
  
  public static GameForm instance() {
    if (singleton == null) {
      singleton = new FrmTestResizeImage();
    }
    return singleton;
  }
  
  public void init(Hashtable parameters) {
    manager.setBackGroundColor(Color.BLACK_CODE);
    
    testImage = ImageUtil.getImage("testImage", "HOT80_3.jpg");
    testImage = ImageUtil.resizeImage(testImage, 240, 320);
  }
  
  public void draw(Graphics g) {
    g.drawImage(testImage, Constants.SCREEN_WIDTH / 2, Constants.SCREEN_HEIGHT / 2, Constants.CENTER_ANCHOR);
  }
  
  public void keyReleased(int keyCode) {
    if (keyCode == Key.SOFT_RIGHT) {
      Global.nextState(FrmMenu.instance(), null);
    }
  }
  
  protected void destroy() {
  }
}
